package com.distributedDataBase.controller;

import com.distributedDataBase.pojo.Result;
import com.distributedDataBase.pojo.User;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("restful")
public class RestfulController {

    @GetMapping("{id}")
    public Result test01(@PathVariable("id") Integer id){
        return new Result("200","根据id查询",id);
    }

    @GetMapping("{id}/{username}")
    public Result test01(@PathVariable("id") Integer id,@PathVariable("username")String username){
        return new Result("200","根据id查询",id+":"+username);
    }

    @DeleteMapping("{id}")
    public Result test02(@PathVariable("id") Integer id){
        return new Result("200","根据id删除",id);
    }

    @PostMapping
    public Result test03(@RequestBody User user){
        return new Result("200","增加一个用户",user);
    }
}
